//
//  LSStatus.swift
//  MicroBlog
//
//  Created by lj on 15/9/9.
//  Copyright © 2015年 itcast. All rights reserved.
//

import UIKit

class LSStatus: NSObject {
    
    // MARK: - 模型属性
    /// 创建时间
    var created_at: String?
    /// 微博ID
    var id: Int = 0
    /// 微博信息内容
    var text: String?
    /// 微博来源
    var source: String?
    /// 配图数组
    var pic_urls: [[String: String]]?
    /// 用户模型
    var user: LSUser?
    
    //MARK: -构造函数
    init(dict: [String: AnyObject]) {
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        
        if key == "user" {
            
            user = LSUser(dict: value as! [String : AnyObject])
            
            return
        }
        
        super.setValue(value, forKey: key)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    override var description:String {
        
        let keys = ["created_at","id","text","source","pic_urls"]
        
        return dictionaryWithValuesForKeys(keys).description
        
    }
    
}
